import _ from 'lodash'
import 'es6-promise/auto';
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);
/**
 * 引入模块
 */
import enterprise from './modules/enterprise'
import judge from './modules/judge'
import draftBeans from './modules/draftBeans'
import message from './modules/message'
import safe from './modules/safe'

// 交易 卖方
import myBill from './modules/myBill'

import actions from './actions'
import mutations from './mutations'
import global from '../common/global'


var storeObj = _.defaultsDeep({
    // @ts-ignore
    // strict: process.env.NODE_ENV !== 'production',
    strict: false,
    modules: {
        enterprise,
        judge,
        draftBeans,
        message,
        safe,
        myBill
    },
    state: {
        userInfo: {},
        tabs: [],
        policy: {
            host: '',
            OSSAccessKeyId: '',
            policy: '',
            saveName: '',
            signature: ''
        },
        allTips: {}
        // sysTime: ''
    },

    getters: {
        policy(state: any) {
            return state.policy
        },
        getAllTips(state: any) {
            return state.allTips
        }
    },
    mutations,
    actions
}, global)

const store = new Vuex.Store(storeObj)

export {
    store
}